import React from 'react';
import './App.css';
import ReactTree from './components/Tree/ReactTree';

function App() {
  const rootData = [
    {
      id: 1,
      title: '体育运动',
      children: [
        {
          id: 1.1,
          title: '球类',
          children: [
            {
              id: '1.1.1',
              title: '篮球',
            },
            {
              id: '1.1.2',
              title: '羽毛球',
            }
          ]
        },
        {
          id: 1.2,
          title: '田径类',
          children: [
            {
              id: '1.2.1',
              title: '短跑',
            },
            {
              id: '1.2.2',
              title: '长跑',
            }
          ]
        }
      ]
    },
    {
      id: 2,
      title: '明星',
    },
    {
      id: 3,
      title: '科学家',
      children: [
        {
          id: 4,
          title: '物理学家',
          children: [
            {
              id: '4.1',
              title: '爱因斯坦',
            },
            {
              id: '4.2',
              title: '牛顿',
            },
            {
              id: '4.3',
              title: '杨振宁',
            }
          ]
        },
      ]
    }
  ]
  return (
    <div className="App">
      <ReactTree
        data={rootData}
        checkbox={true}
        casade={false}
        onChangeExpand={(treeData: any[], currentNode: any[]) => {
          console.log(treeData);
          console.log(currentNode)
        }}
        onSelectNode={(treeData: any[], currentNode: any[]) => {
          console.log(treeData);
          console.log(currentNode)
        }}
      />
    </div>
  );
}

export default App;
